package klasy.powtorka;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class KalendarzGregorianskiJeden {

	public static void main(String[] args) {

		Calendar sylwester = new GregorianCalendar(1999, Calendar.DECEMBER, 31);
		int rok = sylwester.get(Calendar.YEAR);
		System.out.println(rok);
		sylwester.set(Calendar.YEAR, 2012);
		rok = sylwester.get(Calendar.YEAR);
		System.out.println(rok);
		sylwester.add(Calendar.YEAR, -10);
		rok = sylwester.get(Calendar.YEAR);
		System.out.println(rok);

		System.out.println("Year: " + sylwester.get(Calendar.YEAR));
		System.out.println("Month: " + (sylwester.get(Calendar.MONTH) + 1));
		System.out.println("Day: " + sylwester.get(Calendar.DAY_OF_MONTH));
		System.out.println("Day of week: " + Calendar.DAY_OF_WEEK);

		Date dzis = new Date();
		System.out.println(dzis.toString());

		GregorianCalendar dataUrodzenia = new GregorianCalendar(1970, 0, 9);
		Date urodzilemSie = dataUrodzenia.getTime();
		System.out.println(urodzilemSie);
		GregorianCalendar data = new GregorianCalendar();
		data.setTime(urodzilemSie);
		System.out.println(data);

	}
}
